<?
require_once('Local_Settings.php');
require_once('cart/inc/functions/Cart_Functions.php');
?>
<!--Alhier het systeem voor het behoud van een layout op de hele website. Alle wijzigingen aan de layout dienen te gebeuren in de header,body en footer.php bestanden. Enkel de content mag in dit bestand staan.-->
<?php include('style/header-1.php');//hieronder komt de linkerbalk met artikelen ?><?php include('menu.php');//dit zorgt ervoor dat het menu verschijnt. ?>
<?php include('style/body-2.php');//hieronder het midden van de pagina ?>
<?
include('config.php');

// Passkey that got from link 
$passkey=$_GET['passkey'];

$tbl_name1="klant_new";

// Retrieve data from table where row that match this passkey 
$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'";
$result1=mysql_query($sql1);

// If successfully queried 
if($result1){

// Count how many row has this passkey
$count=mysql_num_rows($result1);

// if found this passkey in our database, retrieve data from table "temp_members_db"
if($count==1){

$rows=mysql_fetch_array($result1);
$naam=$rows['naam'];
$tussenvoegsel = $rows['tussenvoegsel'] ;
$achternaam = $rows['achternaam'];
$adres=$rows['adres'];
$woonplaats=$rows['woonplaats']; 
$postc=$rows['postc'];
$telefoon=$rows['telefoon'];
$email=$rows['email'];
$password=$rows['password'];

$tbl_name2="klant";

// Insert data that retrieves from "temp_members_db" into table "registered_members" 
$sql2="INSERT INTO $tbl_name2(voornaam, tussenvoegsel, achternaam, adres, woonplaats, postc, telefoon, email, password)VALUES('$naam', '$tussenvoegsel','$achternaam','$adres', '$woonplaats', '$postc', '$telefoon', '$email','$password')" ;
$result2=mysql_query($sql2) or die(mysql_error());
}

// if not found passkey, display message "Wrong Confirmation code" 
else {
echo "Wrong Confirmation code";
}

// if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
if($result2){

echo "Your account has been activated";

// Delete information of this user from table "temp_members_db" that has this passkey 
$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'";
$result3=mysql_query($sql3);

}

}
?>
<?php include('style/body-3.php');//hieronder de rechterbalk ?>
<? echo ( DisplayCartBald($Session_Prefix,$Currency_Symbol,$Currency_Code));?> 
<?php include('style/footer-4.php');?>